@echo off
chcp 65001 > nul 2>&1


set "folder_list=./mask-ink "

@echo off
set workingDir=%~dp0
set file=allbook.txt
set mark=sn_.
set markNot=public_
echo delete mark: %mark%


if exist %file%  del %file%

setlocal enabledelayedexpansion
for /r %workingDir% %%i in (. *) do ( 
	set "bookname=%%i"
	set "bookNameFile=%%~nxi"
	
	if "!bookname:\.=!" equ "!bookname!" (
		
		echo findstr !bookNameFile!
		
		echo !bookNameFile!| findstr %markNot% >nul && (
			echo "skip >>> " !bookNameFile! 
		) || (
			echo !bookNameFile!| findstr %mark% >nul && (
				echo "delete >>> " !bookname! && del !bookname!
			) || ( echo  "skip >>> " !bookNameFile! )
		)
		
		
		rem file 
		echo -----------------------!bookNameFile!>>%file%
	) else (
		rem dir
		echo= >>%file%
		echo !bookname!>>%file%
	)
	 		
)
setlocal disabledelayedexpansion


REM 这里是脚本的其他部分，不会因为文件或文件夹不存在而受影响，可以继续运行。
pause

